package jumpingnotes.model.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "friend", catalog = "jumping_notes")
public class Friend implements java.io.Serializable
{

	private Integer friendId;
	private Member memberByMemberIdFrom;
	private Member memberByMemberIdTo;
	private Date createTime;

	public Friend()
	{
	}

	public Friend(Member memberByMemberIdFrom, Member memberByMemberIdTo, Date createTime)
	{
		this.memberByMemberIdFrom = memberByMemberIdFrom;
		this.memberByMemberIdTo = memberByMemberIdTo;
		this.createTime = createTime;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "friend_id", unique = true, nullable = false)
	public Integer getFriendId()
	{
		return this.friendId;
	}

	public void setFriendId(Integer friendId)
	{
		this.friendId = friendId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "member_id_from", nullable = false)
	public Member getMemberByMemberIdFrom()
	{
		return this.memberByMemberIdFrom;
	}

	public void setMemberByMemberIdFrom(Member memberByMemberIdFrom)
	{
		this.memberByMemberIdFrom = memberByMemberIdFrom;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "member_id_to", nullable = false)
	public Member getMemberByMemberIdTo()
	{
		return this.memberByMemberIdTo;
	}

	public void setMemberByMemberIdTo(Member memberByMemberIdTo)
	{
		this.memberByMemberIdTo = memberByMemberIdTo;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 19)
	public Date getCreateTime()
	{
		return this.createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

}
